/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.supinfo.youfood.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.*;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

/**
 *
 * @author Michael
 */
@Entity
@Table(name="commande")
public class Commande implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id_commande;
    
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date date_commande;
    
    private String libelle;
    
    @ManyToOne
    private Employe serveur;
    
    @OneToMany(mappedBy = "commande", fetch= FetchType.EAGER)
    @Fetch(FetchMode.SUBSELECT)
    private List<Commande_Produit> list_produits;
    
    @OneToMany(mappedBy = "commande", fetch= FetchType.EAGER)
    @Fetch(FetchMode.SUBSELECT)
    private List<Commande_Menu> list_menus;
    
    @ManyToOne
    @JoinColumn(name="fk_id_table")
    private TableResto tableResto;

    public Commande() {
    }

    public Commande(List<Commande_Menu> list_menus) {
        this.list_menus = list_menus;
    }
    
    public Long getId_commande() {
        return id_commande;
    }

    public void setId_commmande(Long id_commande) {
        this.id_commande = id_commande;
    }

    public Date getDate_commande() {
        return date_commande;
    }

    public void setDate_commande(Date date_commande) {
        this.date_commande = date_commande;
    }

    public String getLibelle() {
        return libelle;
    }

    public void setLibelle(String libelle) {
        this.libelle = libelle;
    }
    
    public Employe getServeur() {
        return serveur;
    }

    public void setServeur(Employe serveur) {
        this.serveur = serveur;
    }

    public List<Commande_Menu> getList_menus() {
        return list_menus;
    }

    public void setList_menus(List<Commande_Menu> list_menus) {
        this.list_menus = list_menus;
    }

    public List<Commande_Produit> getList_produits() {
        return list_produits;
    }

    public void setList_produits(List<Commande_Produit> list_produits) {
        this.list_produits = list_produits;
    }
 
    public TableResto getTableResto() {
        return tableResto;
    }

    public void setTableResto(TableResto tableResto) {
        this.tableResto = tableResto;
    }
}
